package com.alibaba.openfeign.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

@RestController
public class OpenfeignController {
    @GetMapping("/testA")
    public String testA(){
        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
        HttpServletRequest httpServletRequest=((ServletRequestAttributes)requestAttributes).getRequest();
        String token=httpServletRequest.getHeader("Authorization");
        System.out.println(token);
        return "a";
    }
}
